About 627 letters

About 3 minutes

#bytearray

Description: Type conversion to bytearray.

def bytearray(x):
    '''
    Type conversion to bytearray

    :param x: A variable
    :return: The value of x converted to bytearray
    '''

Example:

print(bytearray(10))                            # A bytearray object of length 10, all values 0
print(bytearray(b'hello'))                      # from bytes
print(bytearray('hello', encoding='utf-8'))     # from str

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025